<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>18 继承-原型继承</title>
</head>

<body>
  <script>
    function Parent() {
      this.x = 100;
    }
    Parent.prototype.getX = function getX() {
      return this.x;
    }

    function Child() {
      Parent.call(this) // call/apply都可以
      this.y = 200;
    }
    Child.prototype.getY = function getY() {
      return this.y;
    }

    let c1 = new Child()

    console.log(c1)
    console.log(c1.x) //=> 100
    console.log(c1.getX) //=> undefined
  </script>
</body>

</html>